
package edu.asu.sapa.heuristic;

/**
 * CostEvent: Class represents the costs update event. It's used when propagate
 * the costs in the RMTPG and specify the costs to achieve a given fact is
 * update at a specific time.
 * 
 * Generalize this by changing id to CostFuction<T> (CostEvent<T>) and having
 * a single queue. Enforce Priority<CostEvent<T>>.time >= currentState.time,
 * and at-end preconditions can be supported. (or conditions after 0, in
 * general)
 */
public class CostEvent<T extends CostFunction<?>> implements Comparable<CostEvent<T>> {
	public T o; 
	public float time;
	public float cost;
	public int supportID;

	public CostEvent(T o, float t, float c, int s) {
		this.o = o;
		this.time = t;
		this.cost = c;
		this.supportID = s;
	}

	public void set(T o, float time, float cost, int supportID) {
		this.o = o;
		this.time = time;
		this.cost = cost;
		this.supportID = supportID;
	}

	public int compareTo(CostEvent<T> ce) {
		return (int) (time - ce.time);
	}

}
